<!DOCTYPE html>
<html lang="zh-CN">
<head><meta name="generator" content="Hexo 3.8.0">
  <meta charset="utf-8">
  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
  
  <title itemprop="name">Lambda表达式 | 聂文强的个人博客</title>
  
    <link rel="shortcut icon" href="/images/favicon.ico">
  
  <meta http-equiv="x-dns-prefetch-control" content="on">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Noto+SerifMerriweather|Merriweather+Sans|Source+Code+Pro|Ubuntu:400,700|Noto+Serif+SC" media="all">
  <link rel="dns-prefetch" href="//cdn.jsdelivr.net">
  <link rel="stylesheet" id="saukra_css-css" href="/blog/css/style.css" type="text/css" media="all">
  <link rel="stylesheet" href="/blog/css/lib.min.css" media="all">
  <link rel="stylesheet" href="/blog/css/font.css" media="all">
  <link rel="stylesheet" href="/blog/css/insight.css" media="all">
  <link rel="stylesheet" href="/blog/css/jquery.fancybox.min.css" media="all">
  <link rel="stylesheet" href="/blog/css/zoom.css" media="all">
  <link rel="stylesheet" type="text/css" href="/blog/css/sharejs.css">
<!--   <link rel="stylesheet" id="saukra_css-css" href="https://2heng.xin/wp-content/cache/autoptimize/css/autoptimize_ad42a61f4c7d4bdd9f91afcff6b5dda5.css
" type="text/css" media="all"> -->
  <script>
  /*Initial Variables*/
  var mashiro_option = new Object();
  var mashiro_global = new Object();
  mashiro_option.NProgressON = true;
  /* 
   * 邮箱信息之类的东西可以填在这里，这些js变量基本都作用于sakura-app.js
   * 这样的设置仅是为了方便在基于PHP开发的主题中设置js变量，既然移植到了Node上，我想或许可以精简这一逻辑吧
   */
  mashiro_option.email_domain = "";
  mashiro_option.email_name = "";
  mashiro_option.cookie_version_control = "";
  mashiro_option.qzone_autocomplete = false;
  mashiro_option.site_name = "聂文强の个人博客";
  mashiro_option.author_name = "个人博客";
  mashiro_option.site_url = "http://brokenwings.gitee.io/blog";
  mashiro_option.v_appId = "7h28fK7ml5zBHaNkVEgfPq91-gzGzoHsz";
  mashiro_option.v_appKey = "6cCEaVuVobEqJ6D67OkYKQqJ";
  mashiro_option.mathjax = "0";
  mashiro_option.qq_api_url = "https://api.mashiro.top/qqinfo/"; 
  mashiro_option.qq_avatar_api_url = "https://api.mashiro.top/qqinfo/";

  // mashiro_option.jsdelivr_css_src = "https://cdn.jsdelivr.net/gh/moezx/cdn@3.4.5/css/lib.min.css";
  // mashiro_option.float_player_on = true;

  /*End of Initial Variables*/
  </script>
  <script type="text/javascript">
  var bg = "https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/cover/(0).jpg.webp,https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/cover/(1).jpg.webp,https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/cover/(2).jpg.webp,https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/cover/(3).jpg.webp,https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/cover/(4).jpg.webp,https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/cover/(5).jpg.webp,https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/cover/(6).jpg.webp,https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/cover/(7).jpg.webp".split(",");
  var bgindex = Math.floor(Math.random()*bg.length);
  if (!!window.ActiveXObject || "ActiveXObject" in window) { //is IE?
    alert('朋友，IE浏览器未适配哦~');
  }
  </script>
  <style type="text/css">
  .hljs-ln{border-collapse:collapse}.hljs-ln td{padding:0}.hljs-ln-n:before{content:attr(data-line-number)}
  </style>
  <style type="text/css">.site-top .lower nav{display:block !important;}.author-profile i,.post-like a,.post-share .show-share,.sub-text,.we-info a,span.sitename,.post-more i:hover,#pagination a:hover,.post-content a:hover,.float-content i:hover{color:#FE9600}.feature i,.download,.navigator i:hover,.links ul li:before,.ar-time i,span.ar-circle,.object,.comment .comment-reply-link,.siren-checkbox-radio:checked + .siren-checkbox-radioInput:after{background:#FE9600}::-webkit-scrollbar-thumb{background:#FE9600}.download,.navigator i:hover,.link-title,.links ul li:hover,#pagination a:hover,.comment-respond input[type='submit']:hover{border-color:#FE9600}.entry-content a:hover,.site-info a:hover,.comment h4 a,#comments-navi a.prev,#comments-navi a.next,.comment h4 a:hover,.site-top ul li a:hover,.entry-title a:hover,#archives-temp h3,span.page-numbers.current,.sorry li a:hover,.site-title a:hover,i.iconfont.js-toggle-search.iconsearch:hover,.comment-respond input[type='submit']:hover{color:#FE9600}.comments .comments-main{display:block !important;}.comments .comments-hidden{display:none !important;}background-position:center center;background-attachment:inherit;}
  </style>
</head>
</html>
<body class="page-template page-template-user page-template-page-analytics page-template-userpage-analytics-php page page-id-1297 chinese-font serif isWebKit">
  <div class="scrollbar" id="bar">
  </div>
  <a href="#" class="cd-top faa-float animated"></a>
  <section id="main-container">
    <div class="headertop filter-dot">
  <div id="banner_wave_1"></div>
  <div id="banner_wave_2"></div>
  <figure id="centerbg" class="centerbg">
    <div class="focusinfo no-select">
      <div class="header-tou">
        <a href="http://brokenwings.gitee.io/blog">
          <img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/custom/avatar.jpg">
        </a>
      </div>
      <div class="header-info">
        <p>Don&#39;t worry, be happy!</p>
        <div class="top-social_v2">
          <li id="bg-pre">
            <img class="flipx" src="https://cdn.jsdelivr.net/gh/honjun/cdn@1.6/img/other/next-b.svg">
          </li>
          
            
              
                <li>
                  <a href="http://github.com/broken-wings" target="_blank" class="social-github" title="github">
                    <img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/social/github.png">
                  </a>
                </li>
              
            
              
                <li>
                  <a href="https://music.163.com/#/my/m/music/playlist?id=505325245" target="_blank" class="social-github" title="wangyiyun">
                    <img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/social/wangyiyun.png">
                  </a>
                </li>
              
            
              
                <li>
                  <a href="https://www.zhihu.com/people/brokenwings-9/activities" target="_blank" class="social-github" title="zhihu">
                    <img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/social/zhihu.png">
                  </a>
                </li>
              
            
              
                <li class="wechat">
                  <a href="/#">
                    <img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/social/wechat.png">
                  </a>
                  <div class="wechatInner">
                    <img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/custom/wechat.jpg">
                  </div>
                </li>
              
            
          
          <li id="bg-next">
            <img src="https://cdn.jsdelivr.net/gh/honjun/cdn@1.6/img/other/next-b.svg">
          </li>
        </div>
      </div>
    </div>
  </figure>
  <div id="video-container" style>
    <video style="object-fit: fill" id="bgvideo" class="video" video-name src width="auto" preload="auto">
    </video>
    <div id="video-btn" class="loadvideo videolive">
    </div>
    <div id="video-add">
    </div>
    <div class="video-stu">
    </div>
  </div>
  <div class="headertop-down faa-float animated" onclick="headertop_down()">
    <span>
      <i class="fa fa-chevron-down" aria-hidden="true">
      </i>
    </span>
  </div>
</div>
    <div id="page" class="site wrapper">
      <header class="site-header no-select gizle sabit" role="banner">
  <div class="site-top">
    <div class="site-branding">
      <span class="site-title">
        <span class="logolink moe-mashiro">
          <a href="/blog/">
            <span class="sakurasono">聂文强の</span>
            <span class="shironeko">个人博客</span>
          </a>
        </span>
      </span>
    </div>
    <div class="searchbox search-form-submit">
      <i class="iconfont js-toggle-search iconsearch icon-search">
      </i>
    </div>
    <div id="show-nav" class="showNav mobile-fit">
      <div class="line line1">
      </div>
      <div class="line line2">
      </div>
      <div class="line line3">
      </div>
    </div>
    <div class="lower-cantiner">
      <div class="lower">
        <nav class="mobile-fit-control hide">
          <ul id="menu-new" class="menu">
            
              <li>
                <a href="/blog/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-fort-awesome faa-shake" aria-hidden="true"></i>
                    首页
                  </span>
                </a>
                
              </li>
            
              <li>
                <a href="/blog/archives">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-archive faa-shake" aria-hidden="true"></i>
                    归档
                  </span>
                </a>
                
                  <ul class="sub-menu">
                    
                      <li>
                        <a href="/blog/categories/技术/">
                          <i class="fa fa-code" aria-hidden="true"></i>
                          技术
                        </a>
                      </li>
                    
                      <li>
                        <a href="/blog/categories/生活/">
                          <i class="fa fa-file-text-o" aria-hidden="true"></i>
                          生活
                        </a>
                      </li>
                    
                      <li>
                        <a href="/blog/categories/转载/">
                          <i class="fa fa-book" aria-hidden="true"></i>
                          转载
                        </a>
                      </li>
                    
                  </ul>
                
              </li>
            
              <li>
                <a href="javascript:;">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-list-ul faa-vertical" aria-hidden="true"></i>
                    清单
                  </span>
                </a>
                
                  <ul class="sub-menu">
                    
                      <li>
                        <a href="/blog/bangumi/">
                          <i class="fa fa-film faa-vertical" aria-hidden="true"></i>
                          番组
                        </a>
                      </li>
                    
                      <li>
                        <a href="/blog/music/">
                          <i class="fa fa-headphones" aria-hidden="true"></i>
                          歌单
                        </a>
                      </li>
                    
                  </ul>
                
              </li>
            
              <li>
                <a href="/blog/comment/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-pencil-square-o faa-tada" aria-hidden="true"></i>
                    留言板
                  </span>
                </a>
                
              </li>
            
              <li>
                <a href="/blog/links/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-link faa-shake" aria-hidden="true"></i>
                    友人帐
                  </span>
                </a>
                
              </li>
            
              <li>
                <a href="/blog/donate/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-heart faa-pulse" aria-hidden="true"></i>
                    赞赏
                  </span>
                </a>
                
              </li>
            
              <li>
                <a href="/blog/">
                  <span class="faa-parent animated-hover">
                    <i class="fa  fa-leaf faa-wrench" aria-hidden="true"></i>
                    关于
                  </span>
                </a>
                
                  <ul class="sub-menu">
                    
                      <li>
                        <a href="/blog/about/">
                          <i class="fa fa-meetup" aria-hidden="true"></i>
                          我？
                        </a>
                      </li>
                    
                      <li>
                        <a href="/blog/theme-sakura/">
                          <i class="fa iconfont icon-sakura" aria-hidden="true"></i>
                          主题
                        </a>
                      </li>
                    
                  </ul>
                
              </li>
            
          </ul>
        </nav>
      </div>
    </div>
  </div>
</header>

      <link rel="stylesheet" type="text/css" href="/blog/css/sharejs.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.css">
<div class="pattern-center-blank"></div>

  <div class="pattern-center single-center">
    <!-- 有配图默认渲染第一张 -->
    <div class="pattern-attachment-img lazyload" style="background-image: url(https://raw.githubusercontent.com/Broken-Wings/ImageHosting/master/img/20190712094339.png);" src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/loader/orange.progress-bar-stripe-loader.svg" data-src="https://raw.githubusercontent.com/Broken-Wings/ImageHosting/master/img/20190712094339.png">
    </div>
    <header class="pattern-header single-header">
      <h1 class="entry-title">
      Lambda表达式</h1>
      <p class="entry-census">
        <span>
          <a href>
            <img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/custom/avatar.jpg">
          </a>
        </span>
        <span>
          <a href>BrokenWings</a>
        </span>
        <span class="bull">
        ·</span>
        2019-7-7<span class="bull">
        ·</span>
      <span id="busuanzi_value_page_pv"></span>次阅读</p>
    </header>
  </div>

<div id="content" class="site-content">
  <div id="primary" class="content-area">
    <main id="main" class="site-main" role="main">
      <article id="post-1" class="post-1 post type-post status-publish format-standard has-post-thumbnail hentry category-uncategorized">
        <div class="toc"></div>
        <!--<div class="toc-entry-content"><!-- 套嵌目录使用（主要为了支援评论）-->
        
        <div class="entry-content">
          <h2 id="JAVA中重要的函数接口"><a href="#JAVA中重要的函数接口" class="headerlink" title="JAVA中重要的函数接口"></a>JAVA中重要的函数接口</h2><table>
<thead>
<tr>
<th>接口</th>
<th>抽象方法</th>
<th>功能</th>
<th>参数</th>
<th>返回类型</th>
<th>示例  </th>
</tr>
</thead>
<tbody>
<tr>
<td>Predicate<t></t></td>
<td>test(T t)</td>
<td>判断真假</td>
<td>T</td>
<td>boolean</td>
<td>任天堂是世界的主宰吗？</td>
</tr>
<tr>
<td>Consumer<t></t></td>
<td>accept(T t)</td>
<td>消费消息</td>
<td>T</td>
<td>void</td>
<td>输出一个值</td>
</tr>
<tr>
<td>Function&lt;T,R&gt;</td>
<td>R apply(T t)</td>
<td>将T映射为R（转换功能）</td>
<td>T</td>
<td>R</td>
<td>获得saber对象的名字</td>
</tr>
<tr>
<td>Supplier<t></t></td>
<td>T get()</td>
<td>生产消息</td>
<td>None</td>
<td>T</td>
<td>工厂方法</td>
</tr>
<tr>
<td>UnaryOperator<t></t></td>
<td>T apply(T t)</td>
<td>一元操作</td>
<td>T</td>
<td>T</td>
<td>逻辑非（！）</td>
</tr>
<tr>
<td>BinaryOperator<t></t></td>
<td>apply(T t, U u)</td>
<td>二元操作</td>
<td>（T，T）</td>
<td>T</td>
<td>求两个数的乘积（*）</td>
</tr>
</tbody>
</table>
<h2 id="常用的流操作"><a href="#常用的流操作" class="headerlink" title="常用的流操作"></a>常用的流操作</h2><p>惰性求值：只描述Stream，操作的结果也是Stream，这样的操作称为惰性求值。惰性求值可以像建造者模式一样链式使用，最后再使用及早求值得到最终结果。<br>及早求值：得到最终的结果而不是Stream，这样的操作称为及早求值。<br>总结：返回值是Stream就是惰性求值，反之是及早求值</p>
<h5 id="collect-Collectors-toList-由Stream里的值生成一个List，是一个及早求值得操作，还有toSet-，toMap-等"><a href="#collect-Collectors-toList-由Stream里的值生成一个List，是一个及早求值得操作，还有toSet-，toMap-等" class="headerlink" title="collect(Collectors.toList()) 由Stream里的值生成一个List，是一个及早求值得操作，还有toSet()，toMap()等"></a>collect(Collectors.toList()) 由Stream里的值生成一个List，是一个及早求值得操作，还有toSet()，toMap()等</h5><pre><code>    List&lt;String&gt; collect = Stream.of(&quot;a&quot;, &quot;b&quot;, &quot;c&quot;)
                                 .collect(Collectors.toList());
</code></pre><h5 id="map-可以将一个流中的值转换成一个新的流"><a href="#map-可以将一个流中的值转换成一个新的流" class="headerlink" title="map 可以将一个流中的值转换成一个新的流"></a>map 可以将一个流中的值转换成一个新的流</h5><p>T -&gt; Function -&gt; R<br>转换功能，内部就是Function接口。惰性求值</p>
<pre><code>    List&lt;String&gt; collect = Stream.of(&quot;a&quot;, &quot;b&quot;, &quot;c&quot;)
                                 .map(s -&gt; s.toUpperCase())
                                 .collect(Collectors.toList());
</code></pre><h5 id="filter-便利数据并检查其中的元素"><a href="#filter-便利数据并检查其中的元素" class="headerlink" title="filter 便利数据并检查其中的元素"></a>filter 便利数据并检查其中的元素</h5><p>T -&gt; Predicate -&gt;boolean<br>顾名思义，起过滤筛选的作用。内部就是Predicate接口。惰性求值。</p>
<pre><code>    List&lt;String&gt; collect 
        = Stream.of(&quot;ac&quot;, &quot;bd&quot;, &quot;cn&quot;)
                .filter(s -&gt; s.contains(&quot;b&quot;))
                .collect(Collectors.toList());
</code></pre><h5 id="count-统计功能，一般都是结合filter使用，因为先筛选出我们需要的再统计即可。及早求值"><a href="#count-统计功能，一般都是结合filter使用，因为先筛选出我们需要的再统计即可。及早求值" class="headerlink" title="count 统计功能，一般都是结合filter使用，因为先筛选出我们需要的再统计即可。及早求值"></a>count 统计功能，一般都是结合filter使用，因为先筛选出我们需要的再统计即可。及早求值</h5><pre><code>     List&lt;Track&gt; tracks = asList(new Track(&quot;Bakai&quot;, 524),
                                 new Track(&quot;Viltel&quot;, 378),
                                 new Track(&quot;Timewas&quot;, 451));
     long count = tracks.stream().filter(t -&gt; t.getLength() &lt; 400).count(); 
     System.out.println(count);   
</code></pre><p>输出结果1</p>
<h5 id="flatMap-和map类似，可以将多个Stream合并连接成一个Stream。惰性求值"><a href="#flatMap-和map类似，可以将多个Stream合并连接成一个Stream。惰性求值" class="headerlink" title="flatMap 和map类似，可以将多个Stream合并连接成一个Stream。惰性求值"></a>flatMap 和map类似，可以将多个Stream合并连接成一个Stream。惰性求值</h5><pre><code>     List&lt;Integer&gt; together = Stream.of(asList(1, 2), asList(3, 4))
                                     .flatMap(num -&gt; num.stream())
                                     .collect(Collectors.toList());
</code></pre><h5 id="max和min-取最大值最小值。及早求值。"><a href="#max和min-取最大值最小值。及早求值。" class="headerlink" title="max和min 取最大值最小值。及早求值。"></a>max和min 取最大值最小值。及早求值。</h5><pre><code>    List&lt;Track&gt; tracks = asList(new Track(&quot;Bakai&quot;, 524),
                                 new Track(&quot;Viltel&quot;, 378),
                                 new Track(&quot;Timewas&quot;, 451));

    Optional&lt;Track&gt; t = tracks.stream()   
                              .min(Comparator.comparing(track -&gt;track.getLength()));
    Track track = t.get();
</code></pre><h5 id="reduce-可以实现从一组值中生成一个新的值。及早求值。"><a href="#reduce-可以实现从一组值中生成一个新的值。及早求值。" class="headerlink" title="reduce 可以实现从一组值中生成一个新的值。及早求值。"></a>reduce 可以实现从一组值中生成一个新的值。及早求值。</h5><pre><code>    Integer reduce = Stream.of(1, 2, 3)
                            .reduce(0, (acc, element) -&gt; acc + element);
    System.out.println(reduce);            

</code></pre><p>输出结果6  </p>
<h2 id="高级收集器"><a href="#高级收集器" class="headerlink" title="高级收集器"></a>高级收集器</h2><h5 id="转换成块partitioningBy"><a href="#转换成块partitioningBy" class="headerlink" title="转换成块partitioningBy"></a>转换成块partitioningBy</h5><p>常用的流操作是将其分解成两个集合，Collectors.partitioningBy帮我们实现了，接收一个Predicate函数式接口。<br>将示例学生分为会唱歌与不会唱歌的两个集合。<br>类似数据库partition By。</p>
<pre><code>     //省略List&lt;student&gt; students的初始化
        Map&lt;Boolean, List&lt;Student&gt;&gt; listMap = students.stream().collect(
            Collectors.partitioningBy(student -&gt;
                            student.getSpecialities().
                            contains(SpecialityEnum.SING)));
</code></pre><h5 id="数据分组groupingBy"><a href="#数据分组groupingBy" class="headerlink" title="数据分组groupingBy"></a>数据分组groupingBy</h5><p>数据分组是一种更自然的分割数据操作，与将数据分成 ture 和 false 两部分不同，可以使用任意值对数据分组。Collectors.groupingBy接收一个Function做转换。类似数据库的group by。  </p>
<pre><code>    //省略List&lt;student&gt; students的初始化
         Map&lt;SpecialityEnum, List&lt;Student&gt;&gt; listMap =
              students.stream().collect(
             Collectors.groupingBy(student -&gt; student.getSpecialities().get(0)));
</code></pre><h2 id="方法引用"><a href="#方法引用" class="headerlink" title="方法引用"></a>方法引用</h2><p><strong>old:</strong>    artist -&gt; artist.getName()<br><strong>new:</strong>    Artist::getName<br>方法引用是一种引用方法的轻量级语法，如:ClassName:methodName</p>

        </div>
        <!-- .entry-content -->
        <div class="single-reward">
          <div class="reward-open">赏<div class="reward-main">
              <ul class="reward-row">
                <li class="alipay-code"><img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/custom/donate/AliPayQR.jpg"></li>
                <li class="wechat-code"><img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/custom/donate/WeChanQR.jpg"></li>
              </ul>
            </div>
          </div>
        </div>
        <div style="text-align:center; width: 100%" class="social-share share-mobile" data-disabled="diandian, tencent"></div>
        <footer class="post-footer">
          <div class="post-lincenses"><a href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh" target="_blank" rel="nofollow"><i class="fa fa-creative-commons" aria-hidden="true"></i> 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议</a></div>
          <div class="post-tags">
          </div>
          <div class="post-share">
            <div class="social-share sharehidden share-component"></div>
            <i class="iconfont show-share icon-forward"></i>
          </div>
        </footer><!-- .entry-footer -->
      </article>
      <!-- #post-## -->
      <div class="toc" style="background: none;"></div>
      <section class="post-squares nextprev">
        
          
            <div class="post-nepre half previous">
          
            <a href="/blog/2019/08/13/10分钟了解JWT/" rel="prev">
              <div class="background">
                <img class="lazyload" src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/loader/orange.progress-bar-stripe-loader.svg" data-src="https://raw.githubusercontent.com/Broken-Wings/ImageHosting/master/img/20190813103841.png" style="width: 100%; height: 100%; object-fit: cover; pointer-events: none;" onerror="imgError(this,3)">
              </div>
              <span class="label">
              Previous Post</span>
              <div class="info">
                <h3>
                10分钟了解JWT</h3>
                <hr>
              </div>
            </a>
          </div>
        
        
          
            <div class="post-nepre half next">
          
            <a href="/blog/2019/06/21/Docker入门/" rel="next">
              <div class="background">
                <img class="lazyload" src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.3/img/loader/orange.progress-bar-stripe-loader.svg" data-src="https://raw.githubusercontent.com/Broken-Wings/ImageHosting/master/img/20190614141756.png" style="width: 100%; height: 100%; object-fit: cover; pointer-events: none;" onerror="imgError(this,3)">
              </div>
              <span class="label">
              Next Post</span>
              <div class="info">
                <h3>
                Docker入门</h3>
                <hr>
              </div>
            </a>
          </div>
        
      </section>
      
<div id="vcomments"></div>
<script>
  window.onload = function(){
      var valine = new Valine();
      valine.init({
        el: '#vcomments',
        appId: "7h28fK7ml5zBHaNkVEgfPq91-gzGzoHsz",
        appKey: "6cCEaVuVobEqJ6D67OkYKQqJ",
        path: window.location.pathname,
        placeholder: "你是我一生只会遇见一次的惊喜 ..."
      })
  }
</script>

      <section class="author-profile">
        <div class="info" itemprop="author" itemscope itemtype="http://schema.org/Person">
          <a href class="profile gravatar"><img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/custom/avatar.jpg" itemprop="image" alt="BrokenWings" height="70" width="70"></a>
          <div class="meta">
            <span class="title">Author</span>
            <h3 itemprop="name">
            <a href itemprop="url" rel="author">BrokenWings</a>
            </h3>
          </div>
        </div>
        <hr>
        <p><i class="iconfont icon-write"></i>一个热爱学习的人</p>
      </section>
    </main><!-- #main -->
  </div><!-- #primary -->
</div>



    </div>    
    <div class="ins-search">
    <div class="ins-search-mask"></div>
    <div class="ins-search-container">
        <div class="ins-input-wrapper">
            <input type="text" class="ins-search-input" placeholder="请输入关键词...">
            <span class="ins-close ins-selectable"><i class="fa fa-times-circle"></i></span>
        </div>
        <div class="ins-section-wrapper">
            <div class="ins-section-container"></div>
        </div>
    </div>
</div>
<script>
(function (window) {
    var INSIGHT_CONFIG = {
        TRANSLATION: {
            POSTS: '文章',
            // PAGES: '页面',
            CATEGORIES: '分类',
            TAGS: 'Tags',
        },
        ROOT_URL: '/blog/',
        CONTENT_URL: '/blog/content.json',
    };
    window.INSIGHT_CONFIG = INSIGHT_CONFIG;
})(window);
</script>
    <!-- <footer id="footer">
  
  <div class="outer">
    <div id="footer-info" class="inner">
      &copy; 2021 聂文强<br>
      powered_by <a href="http://hexo.io/" target="_blank">Hexo</a>
    </div>
  </div>
</footer> -->
<footer id="colophon" class="site-footer" role="contentinfo">
  <div class="site-info">
    <div class="footertext">
      <div class="img-preload">
        <img src="https://cdn.jsdelivr.net/gh/broken-wings/cdn@1.3/img/other/wordpress-rotating-ball-o.svg">
        <img src="https://cdn.jsdelivr.net/gh/broken-wings/cdn@1.3/img/other/disqus-preloader.svg">
      </div>
      <p style="color: #666666;">&copy 2019</p>
    </div>
    <div class="footer-device">
    <p style="font-family: 'Ubuntu', sans-serif;">
        <span style="color: #b9b9b9;"> Powered by Hexo, Hosted by Github Pages
        </span>
      </p>
    </div>
  </div><!-- .site-info -->
</footer>



<!-- <script src="/js/tocbot.js"></script> -->
<script type="text/javascript" src="/blog/js/lib.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/clipboard@2/dist/clipboard.min.js"></script>
<script type="text/javascript" src="/blog/js/InsightSearch.js"></script>
<script type="text/javascript" src="/blog/js/jquery.fancybox.min.js"></script>
<script type="text/javascript" src="/blog/js/zoom.min.js"></script>
<script type="text/javascript" src="/blog/js/sakura-app.js"></script>
<script src="//cdn1.lncld.net/static/js/3.0.4/av-min.js"></script>
<script src="//unpkg.com/valine@1.3.4/dist/Valine.min.js"></script>
<!-- 不蒜子 网页计数器 -->
<script src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script>
<!-- <script src="https://cdnjs.cloudflare.com/ajax/libs/tocbot/4.4.2/tocbot.min.js"></script> -->

<script type="text/javascript">
/* <![CDATA[ */
 if (/Android|webOS|iPhone|iPod|BlackBerry/i.test(navigator.userAgent)) {
  var Poi = {"pjax":"1","movies":{"url": "https://cdn.jsdelivr.net/gh/honjun/hojun@1.3","name":"Unbroken.mp4","live":"close"},"windowheight":"fixed","codelamp":"close","ajaxurl":"","order":"asc","formpostion":"bottom"};
} else {
  var Poi = {"pjax":"1","movies":{"url": "https://cdn.jsdelivr.net/gh/honjun/hojun@1.3","name":"Unbroken.mp4","live":"open"},"windowheight":"auto","codelamp":"close","ajaxurl":"","order":"asc","formpostion":"bottom"};
} 
/* ]]> */
</script>

<script>
$(document).ready(function() {
  if ($(".toc").length > 0 && document.body.clientWidth > 1200) {
    if ($(".pattern-center").length > 0) { //有图的情况
      tocbot.init({
          // Where to render the table of contents.
          tocSelector: '.toc', // 放置目录的容器
          // Where to grab the headings to build the table of contents.
          contentSelector: '.entry-content', // 正文内容所在
          // Which headings to grab inside of the contentSelector element.
          scrollSmooth: true,
          headingSelector: 'h1, h2, h3, h4, h5', // 需要索引的标题级别
          headingsOffset: -400,
          scrollSmoothOffset: -85
      });
    } else {
      tocbot.init({
          // Where to render the table of contents.
          tocSelector: '.toc', // 放置目录的容器
          // Where to grab the headings to build the table of contents.
          contentSelector: '.entry-content', // 正文内容所在
          // Which headings to grab inside of the contentSelector element.
          scrollSmooth: true,
          headingSelector: 'h1, h2, h3, h4, h5', // 需要索引的标题级别
          headingsOffset: -85,
          scrollSmoothOffset: -85
      });
    }
    var offsetTop = $('.toc').offset().top - 95;
    window.onscroll = function() {
      var scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop;
      if (scrollTop >= offsetTop) {
        $('.toc').addClass('toc-fixed');
      } else {
        $('.toc').removeClass('toc-fixed');
      }
    }
  }
});
</script>

    <div class="openNav no-select" style="height: 50px;">
      <div class="iconflat no-select" style="width: 50px; height: 50px;">
        <div class="icon"></div>
      </div>
      <div class="site-branding search-form-submit">
        <i class="iconfont js-toggle-search iconsearch icon-search"></i>
      </div>
    </div>
  </section>
  <div id="mo-nav" class>
  <div class="m-avatar">
    <img src="https://cdn.jsdelivr.net/gh/Broken-Wings/cdn@1.31/img/custom/avatar.jpg">
  </div>
  <p style="text-align: center; color: #333; font-weight: 900; font-family: 'Ubuntu', sans-serif; letter-spacing: 1.5px">聂文强の个人博客</p>
  <p style="text-align: center; word-spacing: 20px;">
    
      
        <a href="http://github.com/broken-wings" class="fa fa-github" target="_blank" style="color: #333; margin-left:20px"></a>
      
        <a href="https://wpa.qq.com/msgrd?v=3&uin=772012589&site=qq&menu=yes" class="fa fa-qq" target="_blank" style="color: #25c6fe; margin-left:20px"></a>
      
    
  </p>
  <ul id="menu-new-1" class="menu">
    
      <li>
        <a href="/blog/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-fort-awesome faa-shake" aria-hidden="true"></i>
            首页
          </span>
        </a>
        
      </li>
    
      <li>
        <a href="/blog/archives">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-archive faa-shake" aria-hidden="true"></i>
            归档
          </span>
        </a>
        
          <ul class="sub-menu">
            
              <li>
                <a href="/blog/categories/技术/">
                  <i class="fa fa-code" aria-hidden="true"></i>
                  技术
                </a>
              </li>
            
              <li>
                <a href="/blog/categories/生活/">
                  <i class="fa fa-file-text-o" aria-hidden="true"></i>
                  生活
                </a>
              </li>
            
              <li>
                <a href="/blog/categories/转载/">
                  <i class="fa fa-book" aria-hidden="true"></i>
                  转载
                </a>
              </li>
            
          </ul>
        
      </li>
    
      <li>
        <a href="javascript:;">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-list-ul faa-vertical" aria-hidden="true"></i>
            清单
          </span>
        </a>
        
          <ul class="sub-menu">
            
              <li>
                <a href="/blog/bangumi/">
                  <i class="fa fa-film faa-vertical" aria-hidden="true"></i>
                  番组
                </a>
              </li>
            
              <li>
                <a href="/blog/music/">
                  <i class="fa fa-headphones" aria-hidden="true"></i>
                  歌单
                </a>
              </li>
            
          </ul>
        
      </li>
    
      <li>
        <a href="/blog/comment/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-pencil-square-o faa-tada" aria-hidden="true"></i>
            留言板
          </span>
        </a>
        
      </li>
    
      <li>
        <a href="/blog/links/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-link faa-shake" aria-hidden="true"></i>
            友人帐
          </span>
        </a>
        
      </li>
    
      <li>
        <a href="/blog/donate/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-heart faa-pulse" aria-hidden="true"></i>
            赞赏
          </span>
        </a>
        
      </li>
    
      <li>
        <a href="/blog/">
          <span class="faa-parent animated-hover">
            <i class="fa  fa-leaf faa-wrench" aria-hidden="true"></i>
            关于
          </span>
        </a>
        
          <ul class="sub-menu">
            
              <li>
                <a href="/blog/about/">
                  <i class="fa fa-meetup" aria-hidden="true"></i>
                  我？
                </a>
              </li>
            
              <li>
                <a href="/blog/theme-sakura/">
                  <i class="fa iconfont icon-sakura" aria-hidden="true"></i>
                  主题
                </a>
              </li>
            
          </ul>
        
      </li>
    
  </ul>
  <p style="text-align: center; font-size: 13px; color: #b9b9b9;">&copy 2019 hexo-sakura</p>
</div>
<button onclick="topFunction()" class="mobile-cd-top" id="moblieGoTop" title="Go to top" style="display: none;"><i class="fa fa-chevron-up" aria-hidden="true"></i></button>
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.css">
<script src="https://cdn.jsdelivr.net/npm/aplayer@1.10/dist/APlayer.min.js"></script>
<style>
  .aplayer .aplayer-lrc {
    height: 35px;
  }
  .aplayer .aplayer-lrc p{
    font-size: 16px;
    font-weight: 700;
    line-height: 18px !important;
  }
  .aplayer .aplayer-lrc p.aplayer-lrc-current{
    color: #FF1493;
  }
  .aplayer.aplayer-narrow .aplayer-body{
    left: -66px !important;
  }
  .aplayer.aplayer-fixed .aplayer-lrc {
    display: none;
  }
  .aplayer .aplayer-lrc.aplayer-lrc-hide {
      display:none !important;
  }
  .aplayer.aplayer-fixed .lrc-show {
    display: block;
    background: rgba(255, 255, 255, 0.8);
  }
</style>
<div class="aplayer" data-id="2806337606" data-server="netease" data-type="playlist" data-fixed="true" data-autoplay="false" data-loop="all" data-order="random" data-preload="auto" data-volume="0.7" data-mutex="true" < div>
<script src="https://cdn.jsdelivr.net/npm/meting@1.2/dist/Meting.min.js"></script>
<script>
  $(function(){
    $('body').on('click', '.aplayer', function(){
      if($('.aplayer-button').hasClass('aplayer-play')) {
        $('.aplayer-lrc').removeClass('lrc-show');
      } else {
        $('.aplayer-lrc').addClass('lrc-show');
      }
    })
  });
</script></div>
<script src="/blog/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/blog/live2dw/assets/assets/koharu.model.json"},"display":{"position":"right","width":150,"height":300,"hOffset":30,"vOffset":-20},"mobile":{"show":true,"scale":0.5},"react":{"opacity":0.8,"opacityOnHover":0.2},"log":false});</script></body>
</html>